// 在TS中使用interface接口来描述对象数据的类型，给对象的属性和方法添加类型约束
interface Person {
  id:string,
  name:string,
  age:number,
  gender:string,
  sayHello?:()=>void
}

const p1:Person ={
  id:'001',
  name:'张三',
  age:18,
  gender:'男',
  sayHello(){
    console.log('泥嚎');
  }
}

const arr:Person[]=[
  {id:'002',name:'五百',age:18,gender:'男'},
  {id:'003',name:'李四',age:22,gender:'女'},
  {id:'004',name:'王五',age:25,gender:'男'},
  {id:'005',name:'赵六',age:28,gender:'女'},
]


console.log(p1);
console.log(arr);
